package com.android;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

public class RedPage extends Activity {

	MediaPlayer mpButtonClick;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.redpage);

		// set up the button sound
		final MediaPlayer mpButtonClick = MediaPlayer.create(this,
				R.raw.button21);

		Button button1 = (Button) findViewById(R.id.button1);
		button1.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent("com.android.LOADGREENPAGE"));
				mpButtonClick.start();
			}

		});

	}

	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated constructor stub
		super.onCreateOptionsMenu(menu);
		MenuInflater myMenuInflater = getMenuInflater();
		myMenuInflater.inflate(R.menu.defaultmenu, menu);
		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menuSweet:
			startActivity(new Intent("com.android.DEFAULTMENU"));
			return true;
		case R.id.menuToast:
			// set up in next tutorial
			return true;
		}
		return false;
	}
}
